package org.ymjava.medical.wx.web;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.ymjava.medical.core.util.ResponseUtil;
import org.ymjava.medical.db.AllPackage.biz.BannerListBiz;
import org.ymjava.medical.db.AllPackage.biz.ExamRoomClassBiz;
import org.ymjava.medical.db.AllPackage.biz.NurseBulletinBiz;
import org.ymjava.medical.db.AllPackage.biz.PrepareForClassBiz;
import org.ymjava.medical.db.AllPackage.entity.BannerList;
import org.ymjava.medical.db.AllPackage.entity.ExamRoomClass;
import org.ymjava.medical.db.AllPackage.entity.NurseBulletin;
import org.ymjava.medical.db.AllPackage.entity.PrepareForClass;


import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/wx_answer/home")
public class HomeController {

    private final Log logger = LogFactory.getLog(HomeController.class);

    @Autowired
    private BannerListBiz bannerListBiz;

    @Autowired
    private ExamRoomClassBiz examRoomClassBiz;

    @Autowired
    private PrepareForClassBiz prepareForClassBiz;


    @Autowired
    private NurseBulletinBiz nurseBulletinBiz;



    /**
     * 查询展示数据
     * @return
     */
    @GetMapping("home_list")
    public Object homeList(){

        Map<String,Object> data = new HashMap<>(3);

        //首页轮播图
        List<BannerList> list_banner = bannerListBiz.get_list_sort();
        //考场
        List<ExamRoomClass> list_room = examRoomClassBiz.get_list_sort();
        //备考
        List<PrepareForClass> list_prepare = prepareForClassBiz.get_list_sort();
        //公告
        List<NurseBulletin> list_bulletin = nurseBulletinBiz.get_list_sort();


        data.put("list_banner",list_banner);
        data.put("list_room",list_room);
        data.put("list_prepare",list_prepare);
        data.put("list_bulletin",list_bulletin);


        return ResponseUtil.ok(data);
    }

}
